//
// Created by work on 24-8-30.
//

#ifndef IOT_PLAT_CMODELMGR_H
#define IOT_PLAT_CMODELMGR_H
#include <iot_model_device/device_model_mgr/CSsqlMgr.h>
#include <iot_model_device/device_model_mgr/CRedisDbMgr.h>
namespace iotplat {
    class CModelMgr {
        STATIC_SINGLETON(CModelMgr);
    public:
        /********************************************************模型相关***************************************************************/
        [[maybe_unused]] bool addModel(const CModelInfo& model);
        [[maybe_unused]] bool getRtModel(std::string &userid, std::string &modelName, CModelInfo& model);
        [[maybe_unused]] bool getRtModels(std::string &userid, std::vector<CModelInfo>& models);
        [[maybe_unused]] bool getDataBaseModel(std::string &userid, std::string &modelName, CModelInfo& model);
        [[maybe_unused]] bool getDataBaseModels(std::string &userid, std::vector<CModelInfo>& models);
        [[maybe_unused]] bool delModel(std::string &userid, std::string &modelName);
        [[maybe_unused]] bool changeModel(const CModelInfo& model);

        /********************************************************设备相关***************************************************************/
        [[maybe_unused]] bool addDevice(CRtDeviceInfo& device);
        [[maybe_unused]] bool delDevice(std::string &userid, std::string &modelName, std::string &deviceName);
        [[maybe_unused]] bool changeDevice(CRtDeviceInfo& device);
        [[maybe_unused]] bool getDbDevice(std::string &userid, std::string &modelName, std::string &deviceName, CRtDeviceInfo& device);
        [[maybe_unused]] bool getRtDevice(std::string &userid, std::string &modelName, std::string &deviceName, CRtDeviceInfo& device);
        [[maybe_unused]] bool getDevicesByModel(std::string &userid, std::string &modelName, std::vector<CRtDeviceInfo>& devices);
        [[maybe_unused]] bool getRtDevicesByModel(std::string &userid, std::string &modelName, std::vector<CRtDeviceInfo>& devices);

        /********************************************************遥信相关***************************************************************/
        [[maybe_unused]] bool addModelYx(CRtModelYxInfo& yx);
        [[maybe_unused]] bool getRtModelYx(std::string &userid, std::string &modelName, std::string &yxName, CRtModelYxInfo& yx);
        [[maybe_unused]] bool getRtModelYxs(std::string &userid, std::string &modelName, std::vector<CRtModelYxInfo>& yxs);
        [[maybe_unused]] bool getDataBaseModelYx(std::string &userid, std::string &modelName, std::string &yxName, CRtModelYxInfo& yx);
        [[maybe_unused]] bool getDataBaseModelYxs(std::string &userid, std::string &modelName, std::vector<CRtModelYxInfo>& yxs);
        [[maybe_unused]] bool delModelYx(std::string &userid, std::string &modelName, std::string &yxName);
        [[maybe_unused]] bool changeModelYx(CRtModelYxInfo &yx);

        /********************************************************遥测相关***************************************************************/
        [[maybe_unused]] bool addModelYc(CRtModelYcInfo& yc);
        [[maybe_unused]] bool getRtModelYc(std::string &userid, std::string &modelName, std::string &ycName, CRtModelYcInfo& yc);
        [[maybe_unused]] bool getRtModelYcs(std::string &userid, std::string &modelName, std::vector<CRtModelYcInfo>& ycs);
        [[maybe_unused]] bool getDataBaseModelYc(std::string &userid, std::string &modelName, std::string &ycName, CRtModelYcInfo& yc);
        [[maybe_unused]] bool getDataBaseModelYcs(std::string &userid, std::string &modelName, std::vector<CRtModelYcInfo>& ycs);
        [[maybe_unused]] bool delModelYc(std::string &userid, std::string &modelName, std::string &ycName);
        [[maybe_unused]] bool changeModelYc(const CRtModelYcInfo& yc);

        /********************************************************遥控相关***************************************************************/
        [[maybe_unused]] bool addModelYk(CRtModelYkInfo& yk);
        [[maybe_unused]] bool getRtModelYk(std::string &userid, std::string &modelName, std::string &ykName, CRtModelYkInfo& yk);
        [[maybe_unused]] bool getRtModelYks(std::string &userid, std::string &modelName, std::vector<CRtModelYkInfo>& yks);
        [[maybe_unused]] bool getDataBaseModelYk(std::string &userid, std::string &modelName, std::string &ykName, CRtModelYkInfo& yk);
        [[maybe_unused]] bool getDataBaseModelYks(std::string &userid, std::string &modelName, std::vector<CRtModelYkInfo>& yks);
        [[maybe_unused]] bool delModelYk(std::string &userid, std::string &modelName, std::string &ykName);
        [[maybe_unused]] bool changeModelYk(const CRtModelYkInfo& yk);

        /********************************************************参数相关***************************************************************/
        [[maybe_unused]] bool addModelParameter(CRtModelParameterInfo& parameter);
        [[maybe_unused]] bool getRtModelParameter(std::string &userid, std::string &modelName, std::string &parameterName, CRtModelParameterInfo& parameter);
        [[maybe_unused]] bool getRtModelParameters(std::string &userid, std::string &modelName, std::vector<CRtModelParameterInfo>& parameters);
        [[maybe_unused]] bool getDataBaseModelParameter(std::string &userid, std::string &modelName, std::string &parameterName, CRtModelParameterInfo& parameter);
        [[maybe_unused]] bool getDataBaseModelParameters(std::string &userid, std::string &modelName, std::vector<CRtModelParameterInfo>& parameters);
        [[maybe_unused]] bool delModelParameter(std::string &userid, std::string &modelName, std::string &parameterName);
        [[maybe_unused]] bool changeModelParameter(const CRtModelParameterInfo& parameter);

        [[maybe_unused]] bool reloadModels();
        [[maybe_unused]] bool reloadDevices();
    };
}
#endif //IOT_PLAT_CMODELMGR_H
